package cn.csc.module.pay.dal.mysql.card;

import java.util.*;

import cn.csc.framework.common.pojo.PageResult;
import cn.csc.framework.mybatis.core.query.LambdaQueryWrapperX;
import cn.csc.framework.mybatis.core.mapper.BaseMapperX;
import cn.csc.module.pay.api.card.dto.PayCardRespDTO;
import cn.csc.module.pay.dal.dataobject.card.PayCardDO;
import org.apache.ibatis.annotations.Mapper;
import cn.csc.module.pay.controller.admin.card.vo.*;

/**
 * 见证宝资金账户身份认证 Mapper
 *
 * @author 华南城
 */
@Mapper
public interface PayCardMapper extends BaseMapperX<PayCardDO> {

    default PageResult<PayCardDO> selectPage(PayCardPageReqVO reqVO) {
        return selectPage(reqVO, new LambdaQueryWrapperX<PayCardDO>()
                .eqIfPresent(PayCardDO::getAppUserId, reqVO.getAppUserId())
                .eqIfPresent(PayCardDO::getMerchantId, reqVO.getMerchantId())
                .eqIfPresent(PayCardDO::getMemberGlobalType, reqVO.getMemberGlobalType())
                .likeIfPresent(PayCardDO::getMemberName, reqVO.getMemberName())
                .eqIfPresent(PayCardDO::getMemberGlobalId, reqVO.getMemberGlobalId())
                .eqIfPresent(PayCardDO::getMobile, reqVO.getMobile())
                .eqIfPresent(PayCardDO::getIndivBusinessFlag, reqVO.getIndivBusinessFlag())
                .likeIfPresent(PayCardDO::getCompanyName, reqVO.getCompanyName())
                .eqIfPresent(PayCardDO::getCompanyGlobalType, reqVO.getCompanyGlobalType())
                .eqIfPresent(PayCardDO::getCompanyGlobalId, reqVO.getCompanyGlobalId())
                .eqIfPresent(PayCardDO::getShopId, reqVO.getShopId())
                .likeIfPresent(PayCardDO::getShopName, reqVO.getShopName())
                .eqIfPresent(PayCardDO::getRepFlag, reqVO.getRepFlag())
                .likeIfPresent(PayCardDO::getReprName, reqVO.getReprName())
                .eqIfPresent(PayCardDO::getReprGlobalType, reqVO.getReprGlobalType())
                .eqIfPresent(PayCardDO::getReprGlobalId, reqVO.getReprGlobalId())
                .betweenIfPresent(PayCardDO::getCreateTime, reqVO.getCreateTime())
                .orderByDesc(PayCardDO::getId));
    }

    default List<PayCardDO> selectList(PayCardExportReqVO reqVO) {
        return selectList(new LambdaQueryWrapperX<PayCardDO>()
                .eqIfPresent(PayCardDO::getAppUserId, reqVO.getAppUserId())
                .eqIfPresent(PayCardDO::getMerchantId, reqVO.getMerchantId())
                .eqIfPresent(PayCardDO::getMemberGlobalType, reqVO.getMemberGlobalType())
                .likeIfPresent(PayCardDO::getMemberName, reqVO.getMemberName())
                .eqIfPresent(PayCardDO::getMemberGlobalId, reqVO.getMemberGlobalId())
                .eqIfPresent(PayCardDO::getMobile, reqVO.getMobile())
                .eqIfPresent(PayCardDO::getIndivBusinessFlag, reqVO.getIndivBusinessFlag())
                .likeIfPresent(PayCardDO::getCompanyName, reqVO.getCompanyName())
                .eqIfPresent(PayCardDO::getCompanyGlobalType, reqVO.getCompanyGlobalType())
                .eqIfPresent(PayCardDO::getCompanyGlobalId, reqVO.getCompanyGlobalId())
                .eqIfPresent(PayCardDO::getShopId, reqVO.getShopId())
                .likeIfPresent(PayCardDO::getShopName, reqVO.getShopName())
                .eqIfPresent(PayCardDO::getRepFlag, reqVO.getRepFlag())
                .likeIfPresent(PayCardDO::getReprName, reqVO.getReprName())
                .eqIfPresent(PayCardDO::getReprGlobalType, reqVO.getReprGlobalType())
                .eqIfPresent(PayCardDO::getReprGlobalId, reqVO.getReprGlobalId())
                .betweenIfPresent(PayCardDO::getCreateTime, reqVO.getCreateTime())
                .orderByDesc(PayCardDO::getId));
    }


    PayCardRespDTO getCardInfo(String memberGlobalId);


}
